package cn.demo.um.domain;

import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.mybatisflex.annotation.Table;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.core.constant.SqlOperator;
import com.mybatisflex.core.query.SqlOperators;
import cn.demo.common.mybatisFlex.MyInsertListener;
import cn.demo.common.mybatisFlex.MyUpdateListener;
import cn.demo.common.annotation.Excel;
import io.swagger.v3.oas.annotations.media.Schema;
import com.fasterxml.jackson.annotation.JsonIgnore;
import cn.demo.common.core.domain.BaseEntity;
/**
 * 用户领证贺礼对象 um_wedding_gift
 *
 * @author xtjun
 * @date 2024-07-03
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Table(value = "um_wedding_gift",onInsert = MyInsertListener.class,onUpdate = MyUpdateListener.class)
public class UmWeddingGift extends BaseEntity {
    private static final long serialVersionUID = 1L;

    @Id
    @Schema(description = "id")
    private String id;

    @Excel(name = "用户ID")
    @Schema(description = "用户ID")
    private String userId;

    @Excel(name = "对方姓名")
    @Schema(description = "对方姓名")
    @NotBlank(message = "对方姓名不能为空")
    private String otherName;

    @Excel(name = "对方电话")
    @NotBlank(message = "对方电话不能为空")
    @Schema(description = "对方电话")
    private String otherPhone;

    @Excel(name = "结婚证照片")
    @NotBlank(message = "结婚证照片不能为空")
    @Schema(description = "结婚证照片")
    private String certPic;

    @Excel(name = "联系电话")
    @NotBlank(message = "联系电话不能为空")
    @Schema(description = "联系电话")
    private String contactPhone;

    @Excel(name = "配送地区")
    @NotBlank(message = "配送地区不能为空")
    @Schema(description = "配送地区")
    private String expressArea;

    @Excel(name = "配送地址")
    @NotBlank(message = "配送地址不能为空")
    @Schema(description = "配送地址")
    private String expressAddr;

    @Excel(name = "快递公司")
    @Schema(description = "快递公司")
    private String expressName;

    @Excel(name = "快递单号")
    @Schema(description = "快递单号")
    private String expressCode;

    @Excel(name = "状态", dictType = "gift_status")
    @Schema(description = "状态(字典:gift_status)")
    private Integer status;

    // 自定义字段的 SQL 操作符
    @JsonIgnore
    public static final SqlOperators operators = new SqlOperators() {{
        set(UmWeddingGift::getUserId, SqlOperator.EQUALS);
        set(UmWeddingGift::getOtherName, SqlOperator.LIKE);
        set(UmWeddingGift::getOtherPhone, SqlOperator.LIKE);
        set(UmWeddingGift::getContactPhone, SqlOperator.EQUALS);
        set(UmWeddingGift::getExpressArea, SqlOperator.EQUALS);
        set(UmWeddingGift::getExpressAddr, SqlOperator.EQUALS);
        set(UmWeddingGift::getExpressName, SqlOperator.LIKE);
        set(UmWeddingGift::getExpressCode, SqlOperator.EQUALS);
        set(UmWeddingGift::getStatus, SqlOperator.EQUALS);
    }};
}
